
$configuration = $args[2]
$server = $args[0]
$zip = $args[1]

$msbuild = "C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"
$msdeploy = "`"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe`""

[Array]$options = "/p:Configuration=$configuration", "/p:DeployOnBuild=true", "/t:rebuild";
$solution = "..\WebTasks.sln" 
& $msbuild $solution $options;
Write-Host "Build End..."
Read-Host -Prompt "Press any key to continue..."

function PushToTarget([string]$msdeploy, [string]$zip, [string]$server, [string]$command) {
    #$ff =  $("{0} -verb:sync -source:package={1} -dest:auto,computerName={2} -verbose  -setParamFile:config.SetParametersWCF.xml -presync:runCommand={3}" -f $msdeploy, $zip, $server, $command)
    $ff =  $("{0} -verb:sync -source:package={1} -dest:auto,computerName={2} -setParamFile:config.SetParametersWCF.xml" -f $msdeploy, $zip, $server)
    cmd /C $ff;
}

#$command = "createsite.bat"
Write-Host "Deploy Start..."
PushToTarget $msdeploy $zip $server $command;
Write-Host "Deploy End..."
Read-Host -Prompt "Press any key to continue..."


